Skip to content

Create DataFrame key columns for propagation and simplify key handling - #20

Merged
jeromychu23 merged 3 commits into
mainfrom
codex/evaluate-composite_key-for-polars-api-usage
Mar 16, 2026
Merged

Create DataFrame key columns for propagation and simplify key handling#20
jeromychu23 merged 3 commits into
mainfrom
codex/evaluate-composite_key-for-polars-api-usage

Conversation

@jeromychu23

Copy link
Copy Markdown
Owner

Motivation

  • Replace fragile per-row composite key construction with explicit DataFrame key columns to simplify and speed up propagation logic.
  • Avoid ad-hoc stringification code (value_to_key/composite_key) and rely on polars expressions to produce stable string keys.
  • Simplify the propagate_target_rows API to operate on named key columns rather than slices of column names.

Description

  • Remove value_to_key and composite_key and add key_from_row that reads a precomputed string key from a row by column name.
  • In propagate_target_from_ancestor build temporary key columns __self_key and __parent_key using a local build_key_expr which uses polars.col(...).cast(String).fill_null("<null>") and polars.concat_str(separator="##"), then call with_columns to attach them to the DataFrame.
  • Change propagate_target_rows signature to accept self_key_col and parent_key_col and update its internal lookups to use key_from_row.
  • Drop the temporary key columns before returning the result DataFrame and adapt unit tests to populate and use __self_key/__parent_key via a helper rows_with_keys.

Testing

  • Ran the crate unit tests with cargo test which executed the propagation tests.
  • The test functions blocker_terminates_chain_resolution, node_level_self_blocker_prevents_propagation, node_level_self_blocker_not_later_does_not_block, node_level_parent_blocker_prevents_propagation, and blocker_checks_use_start_target_as_anchor_across_ancestors were executed and passed.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef443181fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs
Comment thread src/lib.rs
@jeromychu23
jeromychu23 merged commit fdff1f4 into main Mar 16, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant